home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pine / ccmd / ccmdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-19  |  4.1 KB  |  208 lines

  1. /*
  2.  * Columbia University Center for Computing Activities, July 1986.
  3.  * Copyright (C) 1986, 1987, Trustees of Columbia University in the City
  4.  * of New York.  Permission is granted to any individual or institution
  5.  * to use, copy, or redistribute this software so long as it is not sold
  6.  * for profit, provided this copyright notice is retained.
  7.  */
  8.  
  9. /*
  10.  * First look for files which can be included unconditionally on any
  11.  * UNIX variant.
  12.  */
  13.  
  14. #include <sys/types.h>
  15. #include <sys/param.h>
  16. #include <sys/ioctl.h>
  17. #include <sys/stat.h>
  18. #include <errno.h>
  19.  
  20. /*
  21.  * Make some initial assumptions.
  22.  *
  23.  * We should be able to configure ourself correctly if running under
  24.  * SunOS, 4.3BSD, HP-UX (s300 or s800), or on a Celerity (?).
  25.  *
  26.  * On 4.2bsd systems, compile with -DBSD
  27.  * On System V Release 3 systems, compile with -DSVR3
  28.  * On System V Release 2 systems, compile with -DSVR2
  29.  * On other System V systems, compile with -DSYSV
  30.  *
  31.  * On 4.1bsd, 32/V, System III, etc, some additional work
  32.  * will probably be necessary.
  33.  */
  34.  
  35. #if !defined(SYSV) && (SVR3 || SVR2)
  36. #define SYSV 1
  37. #endif
  38.  
  39. #if unix && !defined(BSD) && !defined(SYSV)
  40. #   if hpux || u3b || u3b2 || u3b5 || u3b15 || u3b20
  41. #    define SYSV 1
  42. #   else
  43. #   if defined(TIOCNOTTY) || sun || ultrix || accel
  44. #    define BSD 1
  45. #   endif
  46. #   endif /* !SYSV */
  47. #endif /* unix && ... */
  48.  
  49. /*
  50.  * Make a guess as to some os-dependent include files we'll need.
  51.  * These #define's can be overridden in site.h.
  52.  */
  53.  
  54. #if BSD
  55. #define needSYSTIME
  56. #define needFCNTL
  57. #undef  needUNISTD
  58. #define needSYSFILE
  59. #define STRINGS                /* index, rindex, etc */
  60. #define BSTRING                /* bzero, bcopy, etc */
  61. #endif /* BSD */
  62.  
  63. #if SYSV
  64. #define needTERMIO
  65. #define needFCNTL
  66. #define needUNISTD            /* you may need to override */
  67. #undef  needSYSFILE            /*  these two in site.h */
  68. #undef  STRINGS
  69. #undef  BSTRING
  70. #endif /* SYSV */
  71.  
  72. #if SVR3
  73. #define SIGNALHANDLERTYPE void
  74. #define DIRENTLIB
  75. #endif
  76.  
  77. /*
  78.  * Next, include site-specific configuration information.
  79.  * 
  80.  */
  81.  
  82. #include "site.h"
  83.  
  84. /*
  85.  * Now include the rest of the header files and add any other appropriate
  86.  * definitions, based on what we know from the header files included so far.
  87.  */
  88.  
  89. #ifdef needSYSTIME
  90. #include <sys/time.h>
  91. #else
  92. #include <time.h>
  93. #endif
  94.  
  95. /*
  96.  * We need one or more of unistd.h, fcntl.h, and sys/file.h.
  97.  */
  98.  
  99. #ifdef needFCNTL
  100. #include <fcntl.h>
  101. #endif
  102. #ifdef needUNISTD
  103. #include <unistd.h>
  104. #endif
  105. #if !defined(O_RDONLY) || !defined(R_OK)
  106. #define needSYSFILE
  107. #endif
  108. #if !defined(SEEK_SET) && !defined(L_SET)
  109. #define needSYSFILE
  110. #endif
  111. #ifdef needSYSFILE
  112. #include <sys/file.h>
  113. #endif
  114. #if defined(L_SET) && !defined(SEEK_SET)
  115. #define SEEK_SET    L_SET
  116. #define SEEK_CUR    L_INCR
  117. #define SEEK_END    L_XTND
  118. #endif
  119.  
  120. /*
  121.  * tty driver definitions
  122.  */
  123. #ifdef needTERMIO
  124. #include <sys/termio.h>
  125. #else
  126. #include <sgtty.h>
  127. #endif
  128.  
  129. /*
  130.  * CCMD routines generally assume the presence of
  131.  * the Berkeley strings(3) and bstring(3) routines.
  132.  */
  133. #if !defined(STRINGS)
  134. #define index strchr
  135. #define rindex strrchr
  136. #endif
  137.  
  138. #if !defined(BSTRING)
  139. #define bzero(a,b)    memset((a),0,b)
  140. #define bcopy(a,b,c)    memcpy((b),(a),c)
  141. #define bcmp(a,b,c)    memcmp((a),(b),c)
  142. #endif
  143.  
  144. /*
  145.  * We need to define exactly one of DIRLIB, NDIRLIB, DIRENTLIB, or NODIRLIB.
  146.  */
  147.  
  148. #if !defined(DIRLIB) && !defined(NDIRLIB) && !defined(DIRENTLIB)
  149. #if !defined(NODIRLIB)
  150. #   if u3b || u3b2 || u3b5 || u3b15 || u3b20
  151. #    define DIRENTLIB
  152. #   else
  153. #   if hpux
  154. #    define NDIRLIB
  155. #   else
  156. #   if BSD
  157. #    define DIRLIB
  158. #   else
  159. #    define NODIRLIB
  160. #   endif /* !bsd */
  161. #   endif /* !hpux */
  162. #   endif /* !posix */
  163. #endif
  164. #endif
  165.  
  166. #ifdef DIRENTLIB
  167. #   include <dirent.h>
  168. #endif
  169. #ifdef NDIRLIB
  170. #   include <ndir.h>
  171. #endif
  172. #ifdef DIRLIB
  173. #   include <sys/dir.h>
  174. #endif
  175.  
  176. #ifdef NODIRLIB
  177. #   if MSDOS
  178. #    include <dos.h>
  179. #    include <direct.h>
  180. #   endif
  181. #endif
  182.  
  183. /*
  184.  * Miscellaneous other files we need.
  185.  */
  186.  
  187. #include <varargs.h>
  188. #include <signal.h>
  189. #include <ctype.h>
  190. #if unix
  191. #include <utmp.h>
  192. #endif
  193.  
  194. /*
  195.  * On some systems, signal handlers are defined as returning (void).
  196.  */
  197.  
  198. #ifndef SIGNALHANDLERTYPE
  199. #define SIGNALHANDLERTYPE int
  200. #endif
  201. typedef SIGNALHANDLERTYPE (*signal_handler_t) ();
  202.  
  203. /*
  204.  * Finally, include ccmd.h, which includes stdio.h and setjmp.h.
  205.  */
  206.  
  207. #include "ccmd.h"
  208.